home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / sharew / dfue / fax / fddk / asc_fax.c next >
C/C++ Source or Header  |  1992-01-30  |  1KB  |  67 lines

  1. #include <stdio.h>
  2. #include "qfaxdrv.h"
  3.  
  4.  
  5. int        convert(char *filename)
  6. {
  7.     FILE    *F;
  8.     char    *faxtype="ascii";
  9.     int        line=0;
  10.  
  11.  
  12.     printf("reading '%s'\n",filename);
  13.  
  14.     F=fopen(filename,"r");
  15.     if(F)
  16.     {
  17.         char    str[CHAR_PER_LINE+1];
  18.  
  19.  
  20.         while(fgets(str,CHAR_PER_LINE,F))
  21.         {
  22.             if(!line)
  23.             {
  24.                 if(qfax_open(faxtype))        /* neue faxseite oeffnen */
  25.                     return(-2);
  26.  
  27.                 printf("writing '%s'\n",filename);
  28.                 qfax_text("");
  29.             }
  30.  
  31.             qfax_text(str);                    /* eine textzeile nach fax */
  32.             putchar('.');
  33.  
  34.             if(++line==LINES_PER_PAGE-2)    /* seitenende */
  35.             {
  36.                 printf("\n");
  37.                 qfax_text("");
  38.                 qfax_close();
  39.                 line=0;
  40.             }
  41.         }
  42.  
  43.         if(line)
  44.             qfax_close();                    /* letzte faxseite schliessen */
  45.  
  46.         fclose(F);
  47.         return(0);
  48.     }
  49.  
  50.     return(-1);
  51. }
  52.  
  53. extern int verbosedriver;
  54.  
  55. int        main(int argc, char *argv[])
  56. {
  57.     if(qfax_init())                                /* treiber initialisieren */
  58.         return(-1);
  59.  
  60.     verbosedriver=0;                            /* global flag ausschalten */
  61.     while(--argc)
  62.         if(convert(*++argv))
  63.             break;
  64.  
  65.     return(0);
  66. }
  67.